put "You didn't click on the picture" into the message
else
put "You last clicked at " into the message box
put pt after the message box
end if
end if
end mouseUp
-- part 3 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=0 top=10 right=209 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 4 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=46 top=233 right=253 bottom=192
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Display PICT files
----- HyperTalk script -----
on mouseUp
put FileName("PICT") into theFile
show the message box
if theFile is not empty then DispPICT thefile,1,1
put the result into pt
if pt is not empty then
if pt contains "ot" then
put pt into the message box
else if pt is "0,0" then
put "You didn't click on the picture" into the message
else
put "You last clicked at " into the message box
put pt after the message box
end if
end if
end mouseUp
-- part contents for card part 3
----- text -----
This is a demo of the DispPICT XCMD for displaying color pictures on a Mac II. The XCMD resource is inside this stack. Move it to other stacks using ResEdit or a similar utility.
(Note: the command must be typed on one line, or be separated into two lines with an option-Return character.)
Only the fileName parameter is required. It must be in quotes, however, and it must be a complete pathname. DispPICT does not look in the Home stack to determine where to find documents.
"fileName" is the file you want to display. DispPICT can display pictures of type 'PICT', such as those made with MacDraw, Cricket Draw, GrayView, etc. DispPICT can also show any file containing a PICT resource with ID = 0. These files can be used as StartUpScreens and can be generated by several programs.
"windowing" is either 0 or 1. If 1, DispPICT will show the picture in a moveable, resizeable, scrolling window with a zoom and goaway box. If windowing = 0, the picture will be displayed in a fixed window with no borders, a sort of "Post-IT" picture. It will be closed as soon as the user clicks the mouse on top of it. The default is 0.
"bestColors" is either 0 or 1. If 1, DispPICT will determine which colors are best suited for displaying the picture, and will use those. This is useful for pictures with specialized color needs. If 0, DispPICT will use the colors currently available on the Mac. This is probably adequate for most pictures. The default is 0.
"left" and "top" specify where the top left corner of the window will lie on the screen. If left = top = 0, DispPICT will center the picture on the whole screen. This is the default.
"right" and "bottom" specify the bottom right corner of the window. If right = bottom = 0, or if top = bottom = 0, the values are ignored. This is the default.
"delay" specifies the number of seconds you want to the picture to appear on the screen before going away automatically. With this you can set up StartupScreens for stacks that let you continue after a brief pause. The user can still close the window normally (via the goaway box if windowing = 1, or by click on the picture if windowing = 0) before "delay" seconds have passed. If delay = 0 the window will stay up indefinitely. This is the default.
"leftpixel," and "toppixel" allow you to specify what pixel of the actual picture should appear in the top left corner of the window. If windowing = 1, it will look like the user already scrolled to that point. The default is leftpixel = toppixel = 0;
DispPICT also returns a value which HyperCard can access with "the result" function. It specifies the pixel (in h,v coordinates) in the picture that the user lasted clicked on. This allows HyperCard scripts to figure out what part of the photo someone chose, sort of like transparent buttons. If there was no mouse click in the window, the returned value is 0,0.
SPECIAL NOTE: Depending how much memory is available to HyperCard, DispPICT will use two different methods for scrolling when windowing = 1. If there is surplus silicon, it will use an offscreen pixel map for maximum speed. What this means to you is that scrolling will be very smooth. However, if memory is low, DispPICT will not be able to do that trick, and scrolling will be substantially slower. In particular, you can notice this effect by placing HyperCard in ever smaller MultiFinder partitions.
If any error occurs, DispPICT will beep once and return an error message. The possible errors are "File not found," "Not enough memory," and "PICT could not be opened."
Please send any comments or bug reports to one of the following addresses.